package com.zfei.gfb.request;

import com.zfei.gfb.bean.Const;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import com.zfei.gfb.util.ObjUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;


/**
 * @author fgh
 */
@Data
public class H5JobWantedAddRequest {

    // 岗位名称
    @ApiModelProperty(value = "岗位名称", required = true)
    private String name;
    // 岗位薪资，xx元/天，可以是区间
    @ApiModelProperty(value = "岗位薪资，xx元/天，可以是区间", required = true)
    private String salary;

    @ApiModelProperty(value = "结算方式,字符串，前端定义", required = true)
    private String settleMethod;
    // 招聘人数
    @ApiModelProperty(value = "联系人姓名", required = true)
    private String linkName;
    // 联系人电话
    @ApiModelProperty(value = "联系人电话", required = true)
    private String linkPhone;
    // 岗位描述
    @ApiModelProperty(value = "岗位描述", required = true)
    private String content;
    // 所在地区
    @ApiModelProperty(value = "所在地区", required = true)
    private String zone;


    public void checkInsertNull() {
        if (ObjUtil.anyNull(name, salary, linkName, linkPhone, zone, content)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (StringUtils.isAnyBlank(name, salary, linkName, content, zone)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }

        if (content.length() > Const.CONTENT_LENGTH) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
    }
}

